package com.diu.domain.strategy.model.vo;

import com.diu.domain.strategy.service.rule.filter.factory.DefaultLogicFactory;
import com.diu.types.common.Constants;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @author #diu
 * @description #
 * @create #2025/10/12 16:30
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class StrategyAwardRuleModelVO {
    private String ruleModels;

    public String[] raffleMiddleRuleModelList(){
        List<String> ruleModelList = new ArrayList<>();
        String[] ruleModelValues = ruleModels.split(Constants.SPLIT);
        for(String ruleModelValue : ruleModelValues){
            if(DefaultLogicFactory.LogicModel.isMiddle(ruleModelValue)){
                ruleModelList.add(ruleModelValue);
            }
        }
        // 显示指定String数组，如果传入的数组长度为0，toArray会自动分配一个合适大小的数组
        return ruleModelList.toArray(new String[0]);
    }
}
